package com.liang.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liang.entity.CActive;
import com.liang.mapper.CActiveMapper;
import com.liang.service.CActiveService;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author 李昂
 * @since 2020-11-30
 */
@Service("CActiveService")
@CacheConfig(cacheNames = "CActiveMapper")
public class CActiveServiceImpl extends ServiceImpl<CActiveMapper, CActive> implements CActiveService {

    @Override
    @CacheEvict(value = "active",allEntries = true)
    public boolean insertAcive(CActive active) {
        return this.save(active);
    }

    @Override
    @CacheEvict(value = "active",allEntries = true)
    public boolean deleteActive(int aid) {
        return this.removeById(aid);
    }

    @Override
    @Cacheable(value = "active")
    public List<CActive> getActives() {
        return this.baseMapper.getActives();
    }

    @Override
    public List<CActive> getUsers(int id) {
        return this.baseMapper.getUsers(id);
    }

    @Override
    @Cacheable(key = "#id")
    public String getDetail(int id) {
        return this.baseMapper.getDetail(id);
    }

    @Override
    public boolean takeInActive(int aid, String id) {
        return this.baseMapper.takeInActive(aid, id);
    }

    @Override
    public List<CActive> takeActiveCount(String id) {
        return this.baseMapper.takeActiveCount(id);
    }

    @Override
    public boolean CancelActive(String id,int aid) {
        return this.baseMapper.CancelActive(id,aid);
    }


}
